/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;


import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Set;
import javax.persistence.*;

/**
 *
 * @author 7
 */
@Entity
@Table(name = "TEST_SUITES")
@SequenceGenerator(name="seq", sequenceName="p1_seq")
public class JPATestSuite implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Column(name = "SUITE_NAME")
    private String suiteName;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="seq")
    @Column(name = "SUITE_ID")
    private BigInteger suiteId;
   
    @Column(name = "SUITE_DESC")
    private String suiteDesc;
    @Column(name = "PARENT_SUITE")
    private BigInteger parentSuite;
    
    @ManyToMany(targetEntity=JPATestCase.class)
        @JoinTable(name = "SUITES_CASES", joinColumns = {
        @JoinColumn(name = "SUITE_ID", referencedColumnName="SUITE_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "TC_ID", referencedColumnName="TC_ID")})
    private Set<JPATestCase> testcase;

    
    @ManyToMany
        @JoinTable(name = "USERS_SUITES", joinColumns = {
        @JoinColumn(name = "SUITE_ID", referencedColumnName="SUITE_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "USER_ID", referencedColumnName="USER_ID")})
    private Set<JPAUser> users;

    public Set<JPAUser> getUsers() {
        return users;
    }

    public void setUsers(Set<JPAUser> users) {
        this.users = users;
    }
    
    
    public JPATestSuite() {
    }

    public JPATestSuite(BigInteger suiteId) {
        this.suiteId = suiteId;
    }

    public String getSuiteName() {
        return suiteName;
    }

    public void setSuiteName(String suiteName) {
        this.suiteName = suiteName;
    }

    public BigInteger getSuiteId() {
        return suiteId;
    }

    public void setSuiteId(BigInteger suiteId) {
        this.suiteId = suiteId;
    }

    public String getSuiteDesc() {
        return suiteDesc;
    }

    public void setSuiteDesc(String suiteDesc) {
        this.suiteDesc = suiteDesc;
    }

    public BigInteger getParentSuite() {
        return parentSuite;
    }

    public void setParentSuite(BigInteger parentSuite) {
        this.parentSuite = parentSuite;
    }

    
    public Set<JPATestCase> getTestcase() {
        return testcase;
    }

    public void setTestcase(Set<JPATestCase> testcase) {
        this.testcase = testcase;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (suiteId != null ? suiteId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPATestSuite)) {
            return false;
        }
        JPATestSuite other = (JPATestSuite) object;
        if ((this.suiteId == null && other.suiteId != null) || (this.suiteId != null && !this.suiteId.equals(other.suiteId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "toProj.Testsuites[ suiteId=" + suiteId + " ]";
    }
    
}
